package com.zzz.demo.monitor.endpoint;

import org.springframework.boot.actuate.endpoint.annotation.Endpoint;
import org.springframework.boot.actuate.endpoint.annotation.ReadOperation;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.Map;

/**
 * 监控某个变量的数据,状态等。
 */
@Component
@Endpoint(id = "variable")
public class VariableMonitor {

    public int var = 100;

    @ReadOperation
    public Map<String ,String> monitorVar(){
        Map<String, String> result = new HashMap<>();
        result.put("var的值为: ", String.valueOf(var));
        return result;
    }

}
